home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 4049 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  1.7 KB

  1. Path: cnn.Princeton.EDU!franck!tim
  2. From: tim@franck (Tim Hollebeek)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: cin.get() function challenge
  5. Date: 27 Jan 1996 02:39:35 GMT
  6. Organization: Princeton University
  7. Message-ID: <4ec397$nra@cnn.Princeton.EDU>
  8. References: <4eavds$d0u@news.cencom.net>
  9. NNTP-Posting-Host: franck.princeton.edu
  10. X-Newsreader: TIN [version 1.2 PL2]
  11.  
  12. Will Senn (wsenn@cencom.net) wrote:
  13. : Alrighty then!
  14.  
  15. : Some of you may recall my post of a week ago asking for help on getch() and
  16. : cin.  The responses I received were not encouraging.
  17.  
  18. : The problem:
  19. :     Write a function in C++ not using getch() that will read in ONE 
  20. : character at a time, without line buffering.  In other words when the user
  21. : presses ONE key, take and process that keypress.  I had originally asked if
  22. : it was possible to use cin or another iostream for this purpose.  It would be
  23. : nice if someone could definitively address this question.
  24.  
  25. The answer is no.  It isn't possible.  It isn't possible in ANSI C either;
  26. getch() isn't a standard function, though it is widely available.
  27. Unfortunately, I don't know of any stream-friendly, widely available
  28. equivalent for C++.  Check your compiler documentation, it should
  29. document the library functions available.  (Although C++ libraries are
  30. pretty sparse; compiler writers are still struggling to get the
  31. language/new standard library right)
  32.  
  33. : If someone out there has a grip on this rather complex issue,  I would very
  34. : much appreciate a reply, by mail or post.
  35.  
  36. It isn't really complex; it just isn't a language issue.
  37.  
  38. --
  39. Tim Hollebeek      | Everything above is a true statement, for sufficiently
  40. PChem Grad Student | false values of true.
  41. Princeton Univ.    | tim@wfn-shop.princeton.edu
  42. -------------------| http://wfn-shop.princeton.edu/~tim
  43.